import { IContext, IParam } from '../../common';
import { ICtrlActionResult } from '../data-action';
import { ICtrlAbility } from './i-ctrl-ability';

/**
 * 实体部件能力接口
 *
 * @export
 * @interface IDECtrlAbility
 * @extends {ICtrlAbility}
 */
export interface IDECtrlAbility extends ICtrlAbility {
	/**
	 * 获取数据
	 *
	 * @return {*}  {(IParam[] | IParam)}
	 * @memberof IDECtrlAbility
	 */
	getData(): IParam[];

	/**
	 * 加载数据
	 *
	 * @return {*}  {Promise<ICtrlActionResult>}
	 * @memberof IDECtrlAbility
	 */
	load(opts?: IParam): Promise<ICtrlActionResult>;

	/**
	 * 编辑数据
	 *
	 * @return {*}  {void}
	 * @memberof IDECtrlAbility
	 */
	openData(context: IContext, viewParams: IParam, data: IParam[]): void;

	/**
	 * 新建数据
	 *
	 * @return {*}  {void}
	 * @memberof IDECtrlAbility
	 */
	newData(context: IContext, viewParams: IParam, data: IParam[]): void;

	/**
	 * 保存数据
	 *
	 * @return {*}  {Promise<ICtrlActionResult>}
	 * @memberof IDECtrlAbility
	 */
	save(opts?: IParam): Promise<ICtrlActionResult>;

	/**
	 * 删除数据
	 *
	 * @param {IParam} [datas]
	 * @return {*}  {Promise<ICtrlActionResult>}
	 * @memberof IDECtrlAbility
	 */
	remove(datas?: IParam[] | IParam): Promise<ICtrlActionResult>;
}
